package com.godpaper.as9.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.godpaper.as9.bussiness.delegates.AlbumDelegate;
	import com.godpaper.as9.constants.ServiceInfoList;
	import com.godpaper.as9.events.GetAlbumInfoEvent;
	import com.godpaper.as9.model.AlbumModelLocator;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;

	public class GetAlbumInfoCommand extends CommandBase implements ICommand, IResponder
	{
		private var delegate:AlbumDelegate;
		private var albumModel:AlbumModelLocator = AlbumModelLocator.getInstance();
		private var getAlbumInfoEvent:GetAlbumInfoEvent;

		public function GetAlbumInfoCommand()
		{
			super();
			delegate = new AlbumDelegate(this);
		}
		
		override public function execute(event:CairngormEvent):void
		{
			getAlbumInfoEvent = GetAlbumInfoEvent(event);
			delegate.read(ServiceInfoList.OPERATION_READ,null);
		}
		
		override public function result(data:Object):void
		{
			albumModel.albumInfo.source = data.result;
//			trace(data.result);
		}
		
		
	}
}